﻿using ExamDemo.Models;
using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Web;

namespace ExamDemo.Data
{
    public class DataInitlizer: DropCreateDatabaseIfModelChanges<ExamDemoDb>
    {
        protected override void Seed(ExamDemoDb db)

        {
            db.Users.AddRange(new List<Users>
            {
                new Users
                {
                    Username="admin",
                    Password="113"
                },new Users
                {
                    Username="root",
                    Password="113"
                },
            });

            db.Messages.AddRange(new List<Messages>
            {
                new Messages
                {
                    FromUserId=1,
                    Content="明明可以更好的"
                },new Messages
                {
                    FromUserId=2,
                    Content="呀接过"
                },
            });


            db.Comments.AddRange(new List<Comments>
            {
                new Comments
                {
                    FromUserId=1,
                    MsgId=2,
                    Comment="天天想你"
                },new Comments
                {
                    FromUserId=1,
                    MsgId=2,
                    Comment="海纳百川，有容乃大；壁立千仞，无欲则刚。"
                },
            });



            db.SaveChanges();


            base.Seed(db);
        }
    }
}